package com.cn.xiaonuo.common.i18n;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Locale;
import java.util.ResourceBundle;

@Service
public class I18nResourceBundle {

    public ResourceBundle i18n(String multilingual) {
        Locale locale = Locale.SIMPLIFIED_CHINESE;
        if (StringUtils.isNotBlank(multilingual)) {
            if ("ru".equals(multilingual)) {
                locale = Locale.US;
            }
        }
        // 创建工具类对象ResourceBundle
        ResourceBundle bundle = ResourceBundle.getBundle("i18n/msg", locale);
        return bundle;
    }

}
